//package com.aaa.interceptor;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebFilter;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.io.IOException;
//
///**
// * @program: qy158-system
// * @description:
// * @author: 闫克起2
// * @create: 2022-10-12 10:33
// **/
//@WebFilter(urlPatterns = "/*")
//public class LoginFilter implements Filter {
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//         HttpServletRequest request= (HttpServletRequest) servletRequest;
//         HttpServletResponse response = (HttpServletResponse) servletResponse;
//        HttpSession session = request.getSession();
//        String path = request.getRequestURI();
//        if(path.equals("/login.jsp")||path.equals("/login/login")||path.endsWith(".css")
//                ||path.endsWith(".js")||path.endsWith(".jpg")||path.endsWith(".png")){
//            filterChain.doFilter(servletRequest,servletResponse);
//            return;
//        }
//
//        if(session.getAttribute("user")!=null){
//            filterChain.doFilter(servletRequest,servletResponse);
//            return;
//        }
//        response.sendRedirect("/login.jsp");
//
//    }
//
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//
//    }
//}
